package cn.edu.scau.cmi.chenyaoquan.composite.safe;

import com.alibaba.fastjson.JSON;

import javafx.fxml.FXML;
import javafx.scene.control.TextArea;

public class SafeController {
    @FXML
    private  TextArea textArea;
	public  void getSafe() {
		SafeComposite  alibaba = new SafeComposite();
		SafeComposite  taobao = new SafeComposite();
		SafeComposite  zhifubao = new SafeComposite();
		SafeComposite  tianmao = new SafeComposite();
		alibaba.setName("alibaba");
		taobao.setName("taobao");
		zhifubao.setName("zhifubao");
		tianmao.setName("tianmao");
		SafeLeaf alibaba_employee = new SafeLeaf();
		SafeLeaf taobao_employee = new SafeLeaf();
		SafeLeaf zhifubao_employee = new SafeLeaf();
		SafeLeaf tianmao_employee = new SafeLeaf();
		alibaba_employee.setName("alibaba_employee");	
		taobao_employee.setName("taobao_employee");
		zhifubao_employee.setName("zhifubao_employee");
		tianmao_employee.setName("tianmao_employee");
		alibaba.addChild(alibaba_employee);
		alibaba.addChild(taobao);
		alibaba.addChild(zhifubao);
		taobao.addChild(taobao_employee);
		taobao.addChild(tianmao);
		zhifubao.addChild(zhifubao_employee);
		tianmao.addChild(tianmao_employee);
		textArea.appendText(JSON.toJSONString(alibaba.getChildren() , true));
	
	}
}
